﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Helper.FullTextIndex;

namespace TI_EntityLib.TiEntityObjects.Clifar
{
    /// <summary>
    /// Структура соответсвующая запси справочника MnnTradeNmDictionary
    /// </summary>
    public class MnnTradeNmDictionaryRecord : IFullindexObject 
    {
        public string Path { get; set; }
        public string InnNx { get; set; }
        public string TradeNmNx { get; set; }
        public string InnR { get; set; }
        public string InnE { get; set; }        
        public string TradeNmR { get; set; }
        public string TradeNmE { get; set; }

        public override string ToString()
        {
            return Helper.Json<MnnTradeNmDictionaryRecord>.NewtonSerializeObject(this);
        }

        public string ValueInfo
        {
            get { return InnR; }
        }

        public int LengthRank
        {
            get { return Terms.Count; }
        }

        public List<string> Terms
        {
            get
            {
                List<string> l1 = RamEngine.ParseText(InnR);
                List<string> l2 = RamEngine.ParseText(InnE);
                List<string> l3 = RamEngine.ParseText(TradeNmR);
                List<string> l4 = RamEngine.ParseText(TradeNmE);
                l1.AddRange(l2);
                l1.AddRange(l3);
                l1.AddRange(l4);
                return l1;
            }
        }

        public string ID
        {
            get { return Path.Replace(",", "fff"); }
        }
    }
}

